package com.bwie.controller;

import com.bwie.pojo.TbOrder;
import com.bwie.pojo.TbOrderDetail;
import com.bwie.pojo.TbProdInfo;
import com.bwie.service.TbOrderService;
import com.bwie.utils.Result;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/shop/order")
public class TbOrderController {

    @Autowired
    TbOrderService tbOrderService;



    @PostMapping("/addOrder")
    public Result addOrder(@RequestBody List<TbProdInfo> prodInfoList){

        return tbOrderService.addOrder(prodInfoList);
    }


    /**
     * @description 订单列表
     * @params []
     * @return com.bwie.utils.Result
     * @author 杰
     * @date 2025/6/2 18:10
     */
    @PostMapping("/getOrderList")
    public Result getOrderList(@RequestBody PageInfoVo pageInfoVo){
        return tbOrderService.getOrderList(pageInfoVo);
    }


    @PostMapping("/deleteAll")
    public Result deleteAll(@RequestBody List<TbOrder> orders){
        return tbOrderService.deleteAll(orders);
    }



    @GetMapping("/ExportExcel/{ids}")
    public void ExportExcel(@PathVariable("ids") String ids){

        tbOrderService.ExportExcel(ids);

    }


}
